package dragonantithesis.dragonantithesis;

import eos.moe.dragoncore.api.ModelAPI;
import io.lumine.xikage.mythicmobs.adapters.AbstractEntity;
import io.lumine.xikage.mythicmobs.io.MythicLineConfig;
import io.lumine.xikage.mythicmobs.skills.SkillMechanic;
import io.lumine.xikage.mythicmobs.skills.SkillMetadata;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;

public class MythicmobsModelAnimation extends SkillMechanic {

    int animationTime;
    String animationName;
    public MythicmobsModelAnimation(String skill, MythicLineConfig mlc) {
        super(skill,mlc);
        this.ASYNC_SAFE = false;
        this.animationName = mlc.getString(new String[]{"animationName","an","m","mid","model","modelid","s","state"}, "模型动画名字");
        this.animationTime = mlc.getInteger(new String[]{"animationTime","at","li","lo","at"}, 20);

    }
    public boolean cast(SkillMetadata data) {
        return this.castSkill(data, (AbstractEntity)null);
    }

    public boolean castAtEntity(SkillMetadata data, AbstractEntity target) {
        return this.castSkill(data, target);
    }

    boolean castSkill(SkillMetadata data, AbstractEntity e1) {
        Entity bukkitEntity = e1.getBukkitEntity();
        ModelAPI.setEntityAnimation((LivingEntity) bukkitEntity,animationName,animationTime);
        return true;
    }
}
